package lesson15;

public class ExerPerson
{
	String name;
	int age;
	double weight;
	ExerPerson[] friends;
	String peronalNumber;
	boolean isMale;
	
	double money;
	ExerciseCar car;
	
	ExerPerson()
	{
		age = 0;
		weight = 4.0;
	}
	
	ExerPerson(String name, String personalNumber, boolean isMale)
	{
		this.name = name;
		this.peronalNumber = personalNumber;
		this.isMale = isMale;
	}
	ExerPerson(String name, String personalNumber, boolean isMale, double money)
	{
		this(name, personalNumber,isMale);
		this.money = money;
	}
	
	void buyCar (ExerciseCar car)
	{
		if (this.money > car.price)
		{
			this.car = car;
		car.changeOwner(this);
		
		}
	}
	
	double sellCarForScrap()
	{
		this.money += car.calculateCarPriceForScrap(0.37);
		this.car = null;
		return this.money;
	}
	
}
